From 859e431af329c3667afc931060dbf7dfae0b2f87 Mon Sep 17 00:00:00 2001 From: Rob Church Date: Tue, 10 Apr 2007 02:18:42 +0000 Subject: [PATCH] Couple of new hooks; FileUpload and SearchUpdate --- RELEASE-NOTES | 2 ++ docs/hooks.txt | 9 +++++++++ includes/Image.php | 3 +++ includes/SearchUpdate.php | 5 +++++ 4 files changed, 19 insertions(+) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index d7540d7571..2af3079726 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -112,6 +112,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 9046) Special page to list pages without language links * Predefined block reasons added to Special:Blockip * (bug 9508) Special page to list articles with the fewest revisions +* Introduce 'FileUpload' hook; see docs/hooks.txt for more information +* Introduce 'SearchUpdate' hook; see docs/hooks.txt for more information == Bugfixes since 1.9 == diff --git a/docs/hooks.txt b/docs/hooks.txt index 0d0ff78aca..2e10c6dbba 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -378,6 +378,9 @@ $text: text of the mail &$list: List object (defaults to NULL, change it to an object instance and return false override the list derivative used) +'FileUpload': When a file upload occurs +$file : Image object representing the file that was uploaded + 'GetInternalURL': modify fully-qualified URLs used for squid cache purging $title: Title object of page $url: string value as output (out parameter, can modify) @@ -465,6 +468,12 @@ $form : PreferencesForm object &$obj: RawPage object &$text: The text that's going to be the output +'SearchUpdate': Prior to search update completion +$id : Page id +$namespace : Page namespace +$title : Page title +$text : Current text being indexed + 'SiteNoticeBefore': Before the sitenotice/anonnotice is composed &$siteNotice: HTML returned as the sitenotice Return true to allow the normal method of notice selection/rendering to work, diff --git a/includes/Image.php b/includes/Image.php index 0a3aec782e..14dcf3ddf7 100644 --- a/includes/Image.php +++ b/includes/Image.php @@ -1656,6 +1656,9 @@ class Image $article->insertNewArticle( $textdesc, $desc, $minor, $watch, $suppressRC ); } + # Hooks, hooks, the magic of hooks... + wfRunHooks( 'FileUpload', array( $this ) ); + # Add the log entry $log = new LogPage( 'upload' ); $log->addEntry( 'upload', $descTitle, $desc ); diff --git a/includes/SearchUpdate.php b/includes/SearchUpdate.php index aae4a66c86..e79c1d083e 100644 --- a/includes/SearchUpdate.php +++ b/includes/SearchUpdate.php @@ -96,8 +96,13 @@ class SearchUpdate { # Strip wiki '' and ''' $text = preg_replace( "/''[']*/", " ", $text ); wfProfileOut( "$fname-regexps" ); + + wfRunHooks( 'SearchUpdate', array( $this->mId, $this->mNamespace, $this->mTitle, &$text ) ); + + # Perform the actual update $search->update($this->mId, Title::indexTitle( $this->mNamespace, $this->mTitle ), $text); + wfProfileOut( $fname ); } } -- 2.20.1